/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import javax.servlet.RequestDispatcher;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ 
/*    */ public class ConfirmDestroyCustomer extends AbstractAction
/*    */ {
/* 19 */   private int id = 0;
/* 20 */   private boolean isPerson = true;
/*    */ 
/*    */   public ConfirmDestroyCustomer(AbstractHttpServlet servlet) {
/* 23 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public ConfirmDestroyCustomer(AbstractHttpServlet servlet, String id, boolean isPerson)
/*    */   {
/* 28 */     super(servlet);
/* 29 */     this.id = Util.str2Int(id);
/* 30 */     this.isPerson = isPerson;
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 37 */     User user = super.getLoginUser(request);
/* 38 */     if (!user.isCanDelete()) {
/* 39 */       request.getRequestDispatcher("/nopermission.jsp").forward(
/* 40 */         request, response);
/* 41 */       return;
/*    */     }
/*    */ 
/* 44 */     CustomerManager manager = new CustomerManager();
/* 45 */     String customerName = manager.getName(this.id);
/* 46 */     if (customerName == null) {
/* 47 */       request.getRequestDispatcher("/errorpage.jsp").forward(request, 
/* 48 */         response);
/* 49 */       return;
/*    */     }
/*    */ 
/* 52 */     request.setAttribute("name", customerName);
/* 53 */     request.setAttribute("id", String.valueOf(this.id));
/* 54 */     request.setAttribute("isPerson", this.isPerson ? "1" : "0");
/* 55 */     request.getRequestDispatcher("/customer_confirm_destroy.jsp").forward(
/* 56 */       request, response);
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ConfirmDestroyCustomer
 * JD-Core Version:    0.6.1
 */